#pragma once
#include "D3DWnd.h"
#include "DXUT/Optional/DXUTcamera.h"
#include "Utility/DirectoryUtil.h"

class CRenderSphere : public CD3DWnd
{
	DECLARE_DYNAMIC(CRenderSphere)

public:
	CRenderSphere(void);
	virtual ~CRenderSphere(void);

	virtual HRESULT OnCreateResource(ID3D11Device* pd3dDevice);
	virtual HRESULT OnSwapChainResize( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain, 
		const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc);
	virtual	void	OnRender(ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime, float fElapsedTime);
	virtual void OnReleasingSwapChain();
	virtual void OnDestroyResouce();	
	virtual void OnFrameMove(double fTime, float fElapsedTime);
	unsigned int GetNumVertices() {return m_iNumVertices;}
	unsigned int GetNumIndices() {return m_iNumIndices;}
protected:
	void InitVariable();

protected:
	//shared variables
	ID3D11Buffer*             m_pVB;
	ID3D11Buffer*             m_pIB; 
	ID3D11InputLayout*        m_pInputLayout;

	//sphere
	float					m_fRadius;
	unsigned int			m_uSlices;
	unsigned int			m_uStacks;
	unsigned int            m_iNumVertices;
	unsigned int            m_iNumIndices;

	//render tech
	ID3DX11Effect*          m_pEffect;	
	
	//camera
	CModelViewerCamera      m_modelViewCamera;
	//Directory
	CDirectoryUtil*         m_pDirectoryUtil;

protected:
	DECLARE_MESSAGE_MAP()
	virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
};

